package net.wwang.blog.dao;

import net.wwang.blog.pojo.Label;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

public interface LabelDao extends JpaRepository<Label,String>, JpaSpecificationExecutor<Label> {
    @Modifying
    int deleteOneById(String id);

    @Modifying
    @Query(value = "DELETE FROM `t_label` WHERE id = ?1", nativeQuery = true)
    int delLabelById(String id);

    /**
     * 根据id查找Label
     *
     * @param id
     * @return
     */
    Label findOneById(String id);
}
